import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class problem79 {
    public static int whichListIsTheNumberIn(List[] lists, int number) {
        int index = 0;

        if(lists != null) {
            for(int a=0; a<lists.length; a++) {
                if(lists[a].contains(number)) {
                    index = a;
                }
            }
        }

        return index;
    }

    public static Integer toInteger(char character) {
        return Integer.valueOf(((Character)character).toString());
    }

    public static void main(String[] args) {
        File file = new File("keylog.txt");
        FileReader fileReader = null;
        try {
            fileReader = new FileReader(file);
        } catch (FileNotFoundException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        List<Integer>[] lists = new List[10];
        for(int a=0; a<lists.length; a++) {
            lists[a] = new ArrayList<Integer>();
        }

        BufferedReader bufferReader = new BufferedReader(fileReader);
        try {
            while(bufferReader.ready()) {
                String line = bufferReader.readLine();
                int num = Integer.valueOf(line);
                char[] numbers = line.toCharArray();

                for(int i = 0; i < numbers.length; i++) {
                    char numberChar = numbers[i];
                    int number = toInteger(numberChar);

                    int whichList = whichListIsTheNumberIn(lists, number);
                    if(whichList == 0) {
                        if(i == 0) {
                            lists[whichList].add(number);
                        } else {
                            int previousWhichList = whichListIsTheNumberIn(lists, toInteger(numbers[i - 1]));
                            lists[previousWhichList + 1].add(number);
                        }
                    } else {
                        if(i == 0) {
                            lists[whichList].add(number);
                        } else {
                            int previousWhichList = whichListIsTheNumberIn(lists, toInteger(numbers[i - 1]));
                            if(previousWhichList >= whichList) {
                                lists[previousWhichList + 1].add(number);
                            } else {
                                lists[whichList].add(number);
                            }
                        }
                    }
                }

            }
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        List<Integer> numbers = new ArrayList<Integer>();
        for(int a=0; a<lists.length; a++) {
            for(int b=0; b<lists[a].size(); b++) {
                int integer = lists[a].get(b);
                if(a == whichListIsTheNumberIn(lists, integer)) {
                    if(!numbers.contains(integer)) {
                        numbers.add(integer);
                    }
                }
            }
        }

        StringBuilder stringBuilder = new StringBuilder();
        for(Integer number : numbers) {
            stringBuilder.append(number);
        }
        System.out.println(stringBuilder.toString());
    }
}
